<style>
    .mce-tinymce {
        z-index: 999;
    }
</style>
<div class="conteudo">
    <div class="cabecalho">
        <h3>Texto exibido na página inicial do site</h3>
    </div>
    <div class="inner" style="width: 100%; padding: 0">
      
        <form method="post" action="<?php echo site_url('admin/home/salvar'); ?>" id="formTelaInicial" name="formTelaInicial" style="z-index: 99999;">
            <script type="text/javascript" src="<?php echo base_url('assets/js/tinymce/tinymce.min.js'); ?>"></script>
            <script type="text/javascript">
                tinymce.init({
                    selector: "textarea",
                    plugins: [
                        "advlist autolink autosave link image lists charmap print preview hr anchor pagebreak spellchecker",
                        "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
                        "table contextmenu directionality emoticons template textcolor paste fullpage textcolor"
                    ],
                    relative_urls: false,
                    image_list: '<?php echo site_url( "admin/upload/image_list" ); ?>',
                    toolbar1: "newdocument fullpage | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | styleselect formatselect fontselect fontsizeselect",
                    toolbar2: "cut copy paste | searchreplace | bullist numlist | outdent indent blockquote | undo redo | link unlink anchor image media code | inserttime preview | forecolor backcolor",
                    toolbar3: "table | hr removeformat | subscript superscript | charmap emoticons | print fullscreen | ltr rtl | spellchecker | visualchars visualblocks nonbreaking template pagebreak restoredraft",
                    menubar: false,
                    language: "pt_BR",
                    resize: false,
                    toolbar_items_size: 'small',
                    style_formats: [
                        {title: 'Bold text', inline: 'b'},
                        {title: 'Red text', inline: 'span', styles: {color: '#ff0000'}},
                        {title: 'Red header', block: 'h1', styles: {color: '#ff0000'}},
                        {title: 'Example 1', inline: 'span', classes: 'example1'},
                        {title: 'Example 2', inline: 'span', classes: 'example2'},
                        {title: 'Table styles'},
                        {title: 'Table row 1', selector: 'tr', classes: 'tablerow1'}
                    ],
                    templates: [
                        {title: 'Test template 1', content: 'Test 1'},
                        {title: 'Test template 2', content: 'Test 2'}
                    ]
                });
            </script>

            <textarea name="conteudo" style="width: 100%; height: 500px;">
                <?php echo $this->input->post('conteudo'); ?>
            </textarea>
            <input type="hidden" id="content" name="content" value=""/>
            <br/>
        </form>
        <footer class="node-footer" style="text-align: right; padding-bottom: 10px;">
            <ul class="links inline">
                <li class="comment-add last"><a title="cancelar" href="<?php echo site_url('admin/home/index'); ?>">Cancelar</a></li>
                <li class="node-readmore"><a id="upload" title="upload" target="_blank" href="<?php echo site_url('admin/upload/index')?>">Upload imagem</a></li>
                <li class="node-readmore first"><a title="salvar" rel="tag" href="javascript:submitForm();">Salvar</a></li>
            </ul>
        </footer>
    </div>

</div>
<script>
    function submitForm() {
        jQuery('#content').val(tinyMCE.get('conteudo').getBody().innerHTML);
        jQuery('#formTelaInicial').submit();
    }
</script> 
